<template>
  <el-dialog
    title="蚂蚁链数据"
    :visible.sync="dialogVisible"
    width="700px"
    append-to-body
  >
    <el-collapse accordion>
      <el-collapse-item v-for="item in tableData" :key="item.id">
        <template slot="title">
          <div style="display: block;line-height: 20px;">
            <div v-if="item.type == 8">订单用户信息</div>
            <div v-if="item.type == 1">订单信息</div>
            <div v-if="item.type == 2">订单商品信息</div>
            <div v-if="item.type == 3">承诺信息</div>
            <div v-if="item.type == 4 || item.type == 9">履约信息</div>
            <div v-if="item.type == 5 || item.type == 7">物流信息</div>
            <div v-if="item.type == 6">保险信息</div>
            <div>{{ item.create_time }}</div>
          </div>
        </template>
        <div>{{ item.info }}</div>
      </el-collapse-item>
    </el-collapse>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        type="primary"
        @click="dialogVisible=false"
      >关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getTWCLog } from '@/api/aliPayTWC'
// import customPage from '@/components/customPage'
export default {
  // components: { customPage },
  props: ['orderId'],
  data() {
    return {
      activeName: 'deduct',
      dialogVisible: false,
      tableData: []
      // total: 0
    }
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        this.$nextTick(() => {
          this.getDeduct()
        })
      }
    }
  },
  methods: {
    getDeduct() {
      // const { page, pageSize } = this.$refs.customPage
      getTWCLog({
        orderId: this.orderId
      }).then(res => {
        this.tableData = res.data || []
        // this.total = res.total || 0
      })
    }
  }
}
</script>

<style>
</style>
